<?php

namespace app\admin\model;

use think\Model;


class Shop extends Model
{

    

    

    // 表名
    protected $name = 'shop';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];



    public function getStatusList()
    {
        return ['1' => __('试营业'), '2' => __('营业中'), '3' => __('筹备中'), '4' => __('休息中'), '-1' => __('其他')];
    }

    //新增店铺的类型（是否包含台球）
    public function getShopType()
    {
        return ['棋牌' => __('棋牌'), '台球' => __('台球'), 'KTV' => __('KTV')];
    }

    //新增店铺的类型（是否开通平台充值余额）
    public function isJoinBalance()
    {
        return ['-1' => __('不开通'), '1' => __('开通')];
    }


    public function user()
    {
        return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function card()
    {
        return $this->belongsTo('Usercard', 'user_id', 'user_id', [], 'LEFT')->setEagerlyType(0);
    }


    public function agent()
    {
        return $this->belongsTo('User', 'agent_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function supervision()
    {
        return $this->belongsTo('Supervision', 'supervision_id', 'id', [], 'LEFT')->setEagerlyType(0);

    }

    public function getStatus($status){

        if($status == 1){
            return "试营业";
        }else if($status == 2){
            return "营业中";
        }else if($status == 3){
            return "筹备中";
        }else if($status == 4){
            return "休息中";
        }else if($status == 5){

            return "升级维护中";
        }
    }




}
